<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%String path=request.getContextPath(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />
	<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
	<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
	<script type="text/javascript">
		
		
		//$.extend( $.mobile , {pageLoadErrorMessage: "专家都去参加年度峰会了，请稍后再试！"});
		

		
		function formSubmit(){
			if( document.getElementById("form1").checkValidity() ){
				$("#addQuestionSubmit").attr("disabled");
				$.getJSON("<%=path%>/question/add.do",$("#form1").serializeArray(),function(r){
					if(r.success==true){
						$("#textinput2,#textarea3").textinput("disable");
						$("#addQuestionSubmit").parent().hide();
						alert("感谢您的提问请耐心等候");
					}else{
						$("#addQuestionSubmit").removeAttr("disabled").show();
						alert("专家都去参加年度峰会了，请稍后再试！");
					}
				});
			}
			return false;
		}
	</script>
<title>添加新问题</title>
</head>

<body>
	<div data-role="page" id="new_question">
    <div data-theme="a" data-role="header">
        <a data-role="button" href="#page1" data-icon="back" data-iconpos="left" class="ui-btn-left"> 取消 </a>
        <h3>
            我要提问
        </h3>
       
    </div>
    <div data-role="content">
        <form action="<%=path%>/question/add.do" method="POST"  onsubmit="return formSubmit()" id="form1">
            <div data-role="fieldcontain">
                <input name="subject" id="textinput2" placeholder="请输入提问标题" value="${question.subject}" type="text" maxlength="50"  required="true">
            </div>
            <div data-role="fieldcontain">
                <textarea name="content" id="textarea3" placeholder="请输入提问内容" maxlength="1000" required="true">${question.content}</textarea>
            </div>
            
            <input type="submit" value="提交"  id="addQuestionSubmit">
        </form>
    </div>
    
   <jsp:include page="foot.jsp"/>
</div>

</body>
</html>
